home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / gfx / misc / gnuplot-src.lha / gnuplot-3.7.1src / gnuplot-3.7.1.lha / gnuplot-3.7.1 / bitmap.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-11  |  56.4 KB  |  1,189 lines

  1. #ifndef lint ÏÞt-9ìáÅSid = "$Id: bitmap.c,v 1.2.2.2 1999/10/11 17:10:54 lhecking Exp $";
  2. #endif
  3.  
  4. /* GNUPLOT - bitmap.c */
  5.  
  6. /*[
  7.  * Copyright 1986 - 1993, 1998   Thomas Williams, Colin Kelley
  8.  *
  9.  * Permission to use, copy, and distribute this software and its
  10.  * documentation for any purpose with or without fee is hereby granted,
  11.  * provided that the above copyright notice appear in all copies and
  12.  * that both that copyright notice and this permission notice appear
  13.  * in supporting documentation.
  14.  *
  15.  * Permission to modify the software is granted, but not the right to
  16.  * distribute the complete modified source code.  Modifications are to
  17.  * be distributed as patches to the released version.  Permission to
  18.  * distribute binaries produced by compiling modified sources is granted,
  19.  * provided you
  20.  *   1. distribute the corresponding source modifications from the
  21.  *    released version in the form of a patch file along with the binaries,
  22.  *   2. add special version identification to distinguish your version
  23.  *    in addition to the base release version number,
  24.  *   3. provide your name and address as the primary contact for the
  25.  *    support of your modified version, and
  26.  *   4. retain our contact information in regard to use of the base
  27.  *    software.
  28.  * Permission to distribute the released version of the source code along
  29.  * with corresponding source modifications in the form of a patch file is
  30.  * granted with same provisions 2 through 4 for binary distributions.
  31.  *
  32.  * This software is provided "as is" without express or implied warranty
  33.  * to the extent permitted by applicable law.
  34. ]*/
  35.  
  36.  
  37. /*
  38.  * AUTHORS
  39.  * 
  40.  *   Original Software:
  41.  *     Jyrki Yli-Nokari <jty@intrin.UUCP>
  42.  *     Ronald J. Hartranft <rjh2@ns.cc.lehigh.edu>
  43.  *     Russell Lang <rjl@monu1.cc.monash.edu.au>
  44.  */
  45.  
  46.  
  47. /*
  48.    ** General raster plotting routines.
  49.    ** Raster routines written and copyrighted 1987 by
  50.    ** Jyrki Yli-Nokari (jty@intrin.UUCP)
  51.    ** Intrinsic, Ltd.
  52.    **
  53.    ** You may use this code for anything you like as long as
  54.    ** you are not selling it and the credit is given and
  55.    ** this message retained.
  56.    **
  57.  */
  58.  
  59. /* Bitmap plotting routines derived from above raster plotting routines
  60.  * Russell Lang, 1990
  61.  */
  62.  
  63. #include "plot.h"
  64. #include "bitmap.h"
  65.  
  66. /* forward decls */
  67.  
  68. static void b_putc __PROTO((unsigned int, unsigned int, int, unsigned int));
  69.  
  70. bitmap *b_p = (bitmap *) NULL;    /* global pointer to bitmap */
  71. unsigned int b_currx, b_curry;    /* the current coordinates */
  72. unsigned int b_xsize, b_ysize;    /* the size of the bitmap */
  73. unsigned int b_planes;        /* number of color planes */
  74. unsigned int b_psize;        /* size of each plane */
  75. unsigned int b_rastermode;    /* raster mode rotates -90deg */
  76. unsigned int b_linemask = 0xffff;    /* 16 bit mask for dotted lines */
  77. unsigned int b_value = 1;    /* colour of lines */
  78. unsigned int b_hchar;        /* width of characters */
  79. unsigned int b_hbits;        /* actual bits in char horizontally */
  80. unsigned int b_vchar;        /* height of characters */
  81. unsigned int b_vbits;        /* actual bits in char vertically */
  82. unsigned int b_angle;        /* rotation of text */
  83. char_box b_font[FNT_CHARS];    /* the current font */
  84. unsigned int b_pattern[] =
  85. {0xffff, 0x1111,
  86.  0xffff, 0x5555, 0x3333, 0x7777, 0x3f3f, 0x0f0f, 0x5f5f};
  87. int b_maskcount = 0;
  88. unsigned int b_lastx, b_lasty;    /* last pixel set - used by b_line */
  89.  
  90. #define IN(i,size)  ((unsigned)i < (unsigned)size)
  91.  
  92. /* 5x9 font, bottom row first, left pixel in lsb */
  93. char_row GPFAR fnt5x9[FNT_CHARS][FNT5X9_VBITS] = {
  94.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000},
  95.   /*!*/  {000000,000000,0x0004,000000,0x0004,0x0004,0x0004,0x0004,0x0004},
  96.   /*"*/  {000000,000000,000000,000000,000000,000000,0x000a,0x000a,0x000a},
  97.   /*#*/  {000000,000000,0x000a,0x000a,0x001f,0x000a,0x001f,0x000a,0x000a},
  98.   /*$*/  {000000,000000,0x0004,0x000f,0x0014,0x000e,0x0005,0x001e,0x0004},
  99.   /*%*/  {000000,000000,0x0018,0x0019,0x0002,0x0004,0x0008,0x0013,0x0003},
  100.   /*&*/  {000000,000000,0x0016,0x0009,0x0015,0x0002,0x0005,0x0005,0x0002},
  101.   /*'*/  {000000,000000,000000,000000,000000,0x0002,0x0004,0x0006,0x0006},
  102.   /*(*/  {000000,000000,0x0008,0x0004,0x0002,0x0002,0x0002,0x0004,0x0008},
  103.   /*)*/  {000000,000000,0x0002,0x0004,0x0008,0x0008,0x0008,0x0004,0x0002},
  104.   /***/  {000000,000000,0x0004,0x0015,0x000e,0x001f,0x000e,0x0015,0x0004},
  105.   /*+*/  {000000,000000,000000,0x0004,0x0004,0x001f,0x0004,0x0004,000000},
  106.   /*,*/  {000000,0x0002,0x0004,0x0006,0x0006,000000,000000,000000,000000},
  107.   /*-*/  {000000,000000,000000,000000,000000,0x001f,000000,000000,000000},
  108.   /*.*/  {000000,000000,0x0006,0x0006,000000,000000,000000,000000,000000},
  109.   /*-/-*/{000000,000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,000000},
  110.   /*0*/  {000000,000000,0x000e,0x0011,0x0013,0x0015,0x0019,0x0011,0x000e},
  111.   /*1*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0006,0x0004},
  112.   /*2*/  {000000,000000,0x001f,0x0001,0x0001,0x000e,0x0010,0x0011,0x000e},
  113.   /*3*/  {000000,000000,0x000e,0x0011,0x0010,0x000c,0x0010,0x0011,0x000e},
  114.   /*4*/  {000000,000000,0x0008,0x0008,0x001f,0x0009,0x000a,0x000c,0x0008},
  115.   /*5*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x000f,0x0001,0x001f},
  116.   /*6*/  {000000,000000,0x000e,0x0011,0x0011,0x000f,0x0001,0x0002,0x000c},
  117.   /*7*/  {000000,000000,0x0001,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  118.   /*8*/  {000000,000000,0x000e,0x0011,0x0011,0x000e,0x0011,0x0011,0x000e},
  119.   /*9*/  {000000,000000,0x0006,0x0008,0x0010,0x001e,0x0011,0x0011,0x000e},
  120.   /*:*/  {000000,000000,000000,0x0006,0x0006,000000,0x0006,0x0006,000000},
  121.   /*;*/  {000000,0x0001,0x0002,0x0006,0x0006,000000,0x0006,0x0006,000000},
  122.   /*<*/  {000000,000000,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,0x0008},
  123.   /*=*/  {000000,000000,000000,000000,0x001f,000000,0x001f,000000,000000},
  124.   /*>*/  {000000,000000,0x0002,0x0004,0x0008,0x0010,0x0008,0x0004,0x0002},
  125.   /*?*/  {000000,000000,0x0004,000000,0x0004,0x0008,0x0010,0x0011,0x000e},
  126.   /*@*/  {000000,000000,0x000e,0x0015,0x0015,0x0016,0x0010,0x0011,0x000e},
  127.   /*A*/  {000000,000000,0x0011,0x0011,0x001f,0x0011,0x0011,0x000a,0x0004},
  128.   /*B*/  {000000,000000,0x000f,0x0012,0x0012,0x000e,0x0012,0x0012,0x000f},
  129.   /*C*/  {000000,000000,0x000e,0x0011,0x0001,0x0001,0x0001,0x0011,0x000e},
  130.   /*D*/  {000000,000000,0x000f,0x0012,0x0012,0x0012,0x0012,0x0012,0x000f},
  131.   /*E*/  {000000,000000,0x001f,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  132.   /*F*/  {000000,000000,0x0001,0x0001,0x0001,0x0007,0x0001,0x0001,0x001f},
  133.   /*G*/  {000000,000000,0x001e,0x0011,0x0011,0x0019,0x0001,0x0001,0x001e},
  134.   /*H*/  {000000,000000,0x0011,0x0011,0x0011,0x001f,0x0011,0x0011,0x0011},
  135.   /*I*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x000e},
  136.   /*J*/  {000000,000000,0x000e,0x0011,0x0010,0x0010,0x0010,0x0010,0x0010},
  137.   /*K*/  {000000,000000,0x0011,0x0009,0x0005,0x0003,0x0005,0x0009,0x0011},
  138.   /*L*/  {000000,000000,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  139.   /*M*/  {000000,000000,0x0011,0x0011,0x0011,0x0015,0x0015,0x001b,0x0011},
  140.   /*N*/  {000000,000000,0x0011,0x0011,0x0011,0x0019,0x0015,0x0013,0x0011},
  141.   /*O*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x000e},
  142.   /*P*/  {000000,000000,0x0001,0x0001,0x0001,0x000f,0x0011,0x0011,0x000f},
  143.   /*Q*/  {000000,0x0018,0x000e,0x0015,0x0011,0x0011,0x0011,0x0011,0x000e},
  144.   /*R*/  {000000,000000,0x0011,0x0009,0x0005,0x000f,0x0011,0x0011,0x000f},
  145.   /*S*/  {000000,000000,0x000e,0x0011,0x0010,0x000e,0x0001,0x0011,0x000e},
  146.   /*T*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x001f},
  147.   /*U*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x0011,0x0011,0x0011},
  148.   /*V*/  {000000,000000,0x0004,0x0004,0x000a,0x000a,0x0011,0x0011,0x0011},
  149.   /*W*/  {000000,000000,0x0011,0x001b,0x0015,0x0011,0x0011,0x0011,0x0011},
  150.   /*X*/  {000000,000000,0x0011,0x0011,0x000a,0x0004,0x000a,0x0011,0x0011},
  151.   /*Y*/  {000000,000000,0x0004,0x0004,0x0004,0x0004,0x000a,0x0011,0x0011},
  152.   /*Z*/  {000000,000000,0x001f,0x0001,0x0002,0x0004,0x0008,0x0010,0x001f},
  153.   /*[*/  {000000,000000,0x000e,0x0002,0x0002,0x0002,0x0002,0x0002,0x000e},
  154.   /*\*/  {000000,000000,000000,0x0010,0x0008,0x0004,0x0002,0x0001,000000},
  155.   /*]*/  {000000,000000,0x000e,0x0008,0x0008,0x0008,0x0008,0x0008,0x000e},
  156.   /*^*/  {000000,000000,000000,000000,000000,000000,0x0011,0x000a,0x0004},
  157.   /*_*/  {000000,000000,0x001f,000000,000000,000000,000000,000000,000000},
  158.   /*`*/  {000000,000000,000000,000000,000000,0x0008,0x0004,0x000c,0x000c},
  159.   /*a*/  {000000,000000,0x001e,0x0011,0x001e,0x0010,0x000e,000000,000000},
  160.   /*b*/  {000000,000000,0x000d,0x0013,0x0011,0x0013,0x000d,0x0001,0x0001},
  161.   /*c*/  {000000,000000,0x000e,0x0011,0x0001,0x0011,0x000e,000000,000000},
  162.   /*d*/  {000000,000000,0x0016,0x0019,0x0011,0x0019,0x0016,0x0010,0x0010},
  163.   /*e*/  {000000,000000,0x000e,0x0001,0x001f,0x0011,0x000e,000000,000000},
  164.   /*f*/  {000000,000000,0x0004,0x0004,0x0004,0x000e,0x0004,0x0014,0x0008},
  165.   /*g*/  {0x000e,0x0011,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  166.   /*h*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,0x0001,0x0001},
  167.   /*i*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0006,000000,0x0004},
  168.   /*j*/  {0x0006,0x0009,0x0008,0x0008,0x0008,0x0008,0x000c,000000,0x0008},
  169.   /*k*/  {000000,000000,0x0009,0x0005,0x0003,0x0005,0x0009,0x0001,0x0001},
  170.   /*l*/  {000000,000000,0x000e,0x0004,0x0004,0x0004,0x0004,0x0004,0x0006},
  171.   /*m*/  {000000,000000,0x0015,0x0015,0x0015,0x0015,0x000b,000000,000000},
  172.   /*n*/  {000000,000000,0x0011,0x0011,0x0011,0x0013,0x000d,000000,000000},
  173.   /*o*/  {000000,000000,0x000e,0x0011,0x0011,0x0011,0x000e,000000,000000},
  174.   /*p*/  {0x0001,0x0001,0x000d,0x0013,0x0011,0x0013,0x000d,000000,000000},
  175.   /*q*/  {0x0010,0x0010,0x0016,0x0019,0x0011,0x0019,0x0016,000000,000000},
  176.   /*r*/  {000000,000000,0x0001,0x0001,0x0001,0x0013,0x000d,000000,000000},
  177.   /*s*/  {000000,000000,0x000f,0x0010,0x000e,0x0001,0x001e,000000,000000},
  178.   /*t*/  {000000,000000,0x0008,0x0014,0x0004,0x0004,0x001f,0x0004,0x0004},
  179.   /*u*/  {000000,000000,0x0016,0x0019,0x0011,0x0011,0x0011,000000,000000},
  180.   /*v*/  {000000,000000,0x0004,0x000a,0x0011,0x0011,0x0011,000000,000000},
  181.   /*w*/  {000000,000000,0x000a,0x0015,0x0015,0x0011,0x0011,000000,000000},
  182.   /*x*/  {000000,000000,0x0011,0x000a,0x0004,0x000a,0x0011,000000,000000},
  183.   /*y*/  {0x000e,0x0010,0x001e,0x0011,0x0011,0x0011,0x0011,000000,000000},
  184.   /*z*/  {000000,000000,0x001f,0x0002,0x0004,0x0008,0x001f,000000,000000},
  185.   /*{*/  {000000,000000,0x0008,0x0004,0x0004,0x0002,0x0004,0x0004,0x0008},
  186.   /*|*/  {000000,000000,0x0004,0x0004,0x0004,000000,0x0004,0x0004,0x0004},
  187.   /*}*/  {000000,000000,0x0002,0x0004,0x0004,0x0008,0x0004,0x0004,0x0002},
  188.   /*~*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0015,0x0002},
  189.   /*DEL*/{000000,000000,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f,0x001f},
  190. };
  191.  
  192. /* 9x17 font, bottom row first, left pixel in lsb */
  193. char_row GPFAR fnt9x17[FNT_CHARS][FNT9X17_VBITS] = {
  194.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  195.           000000,000000,000000,000000,000000,000000,000000,000000},
  196.   /*!*/  {000000,000000,000000,000000,0x0010,000000,000000,000000,0x0010,
  197.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010},
  198.   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  199.           000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x0044},
  200.   /*#*/  {000000,000000,000000,000000,0x0044,0x0044,0x0044,0x0044,0x01ff,
  201.           0x0044,0x0044,0x0044,0x01ff,0x0044,0x0044,0x0044,0x0044},
  202.   /*$*/  {000000,000000,000000,000000,0x0010,0x0010,0x007e,0x0091,0x0110,
  203.           0x0090,0x007c,0x0012,0x0011,0x0112,0x00fc,0x0010,0x0010},
  204.   /*%*/  {000000,000000,000000,000000,0x0080,0x0141,0x0081,0x0002,0x0004,
  205.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0102,0x0105,0x0002},
  206.   /*&*/  {000000,000000,000000,000000,0x011c,0x00a2,0x0041,0x00c1,0x0141,
  207.           0x0022,0x001c,0x0014,0x0022,0x0022,0x001c,000000,000000},
  208.   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  209.           000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010},
  210.   /*(*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0008,
  211.           0x0004,0x0004,0x0004,0x0008,0x0008,0x0010,0x0020,0x0040},
  212.   /*)*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0020,
  213.           0x0040,0x0040,0x0040,0x0020,0x0020,0x0010,0x0008,0x0004},
  214.   /***/  {000000,000000,000000,000000,0x0010,0x0010,0x0111,0x0092,0x0054,
  215.           0x0038,0x01ff,0x0038,0x0054,0x0092,0x0111,0x0010,0x0010},
  216.   /*+*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0010,0x0010,
  217.           0x0010,0x01ff,0x0010,0x0010,0x0010,0x0010,000000,000000},
  218.   /*,*/  {000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,000000,
  219.           000000,000000,000000,000000,000000,000000,000000,000000},
  220.   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  221.           000000,0x01ff,000000,000000,000000,000000,000000,000000},
  222.   /*.*/  {000000,000000,000000,000000,0x0010,0x0038,0x0010,000000,000000,
  223.           000000,000000,000000,000000,000000,000000,000000,000000},
  224.   /*-/-*/{000000,000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,
  225.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,000000,000000},
  226.   /*0*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0103,0x0105,
  227.           0x0109,0x0111,0x0121,0x0141,0x0181,0x0101,0x0082,0x007c},
  228.   /*1*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  229.           0x0010,0x0010,0x0010,0x0010,0x0010,0x001c,0x0018,0x0010},
  230.   /*2*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  231.           0x0002,0x007c,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  232.   /*3*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  233.           0x0080,0x0078,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  234.   /*4*/  {000000,000000,000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,
  235.           0x01ff,0x0041,0x0042,0x0044,0x0048,0x0050,0x0060,0x0040},
  236.   /*5*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  237.           0x0100,0x0080,0x007f,0x0001,0x0001,0x0001,0x0001,0x01ff},
  238.   /*6*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  239.           0x0081,0x007f,0x0001,0x0001,0x0001,0x0002,0x0084,0x0078},
  240.   /*7*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0002,0x0004,
  241.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0100,0x01ff},
  242.   /*8*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  243.           0x0082,0x007c,0x0082,0x0101,0x0101,0x0101,0x0082,0x007c},
  244.   /*9*/  {000000,000000,000000,000000,0x001c,0x0022,0x0040,0x0080,0x0100,
  245.           0x0100,0x01fc,0x0102,0x0101,0x0101,0x0101,0x0082,0x007c},
  246.   /*:*/  {000000,000000,000000,000000,000000,000000,0x0010,0x0038,0x0010,
  247.           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  248.   /*;*/  {000000,000000,000000,0x0004,0x0008,0x0010,0x0030,0x0038,0x0010,
  249.           000000,000000,000000,0x0010,0x0038,0x0010,000000,000000},
  250.   /*<*/  {000000,000000,000000,000000,0x0040,0x0020,0x0010,0x0008,0x0004,
  251.           0x0002,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040},
  252.   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x01ff,
  253.           000000,000000,000000,0x01ff,000000,000000,000000,000000},
  254.   /*>*/  {000000,000000,000000,000000,0x0004,0x0008,0x0010,0x0020,0x0040,
  255.           0x0080,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008,0x0004},
  256.   /*?*/  {000000,000000,000000,0x0010,0x0038,0x0010,000000,0x0010,0x0010,
  257.           0x0020,0x0040,0x0080,0x0100,0x0100,0x0101,0x0082,0x007c},
  258.   /*@*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x01f9,0x0145,
  259.           0x0145,0x0145,0x0179,0x0101,0x0101,0x0101,0x0082,0x007c},
  260.   /*A*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x01ff,
  261.           0x0101,0x0082,0x0082,0x0044,0x0044,0x0028,0x0028,0x0010},
  262.   /*B*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  263.           0x0084,0x007c,0x0084,0x0104,0x0104,0x0104,0x0084,0x007f},
  264.   /*C*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  265.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0101,0x0082,0x007c},
  266.   /*D*/  {000000,000000,000000,000000,0x007f,0x0084,0x0104,0x0104,0x0104,
  267.           0x0104,0x0104,0x0104,0x0104,0x0104,0x0104,0x0084,0x007f},
  268.   /*E*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0001,0x0001,0x0001,
  269.           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  270.   /*F*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  271.           0x0001,0x001f,0x0001,0x0001,0x0001,0x0001,0x0001,0x01ff},
  272.   /*G*/  {000000,000000,000000,000000,0x00fc,0x0102,0x0101,0x0101,0x0101,
  273.           0x0101,0x01c1,0x0001,0x0001,0x0001,0x0001,0x0102,0x00fc},
  274.   /*H*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  275.           0x0101,0x01ff,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  276.   /*I*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  277.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x007c},
  278.   /*J*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  279.           0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0100,0x0180},
  280.   /*K*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  281.           0x0009,0x0005,0x000b,0x0011,0x0021,0x0041,0x0081,0x0101},
  282.   /*L*/  {000000,000000,000000,000000,0x01ff,0x0101,0x0001,0x0001,0x0001,
  283.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  284.   /*M*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  285.           0x0101,0x0111,0x0111,0x0129,0x0145,0x0145,0x0183,0x0101},
  286.   /*N*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0181,0x0141,
  287.           0x0141,0x0121,0x0111,0x0109,0x0105,0x0105,0x0103,0x0101},
  288.   /*O*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  289.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  290.   /*P*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  291.           0x0001,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  292.   /*Q*/  {000000,000000,0x0180,0x0040,0x007c,0x0092,0x0101,0x0101,0x0101,
  293.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0082,0x007c},
  294.   /*R*/  {000000,000000,000000,000000,0x0101,0x0081,0x0041,0x0021,0x0011,
  295.           0x0009,0x007f,0x0081,0x0101,0x0101,0x0101,0x0081,0x007f},
  296.   /*S*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0100,0x0100,
  297.           0x0080,0x007c,0x0002,0x0001,0x0001,0x0101,0x0082,0x007c},
  298.   /*T*/  {000000,000000,000000,000000,0x0038,0x0010,0x0010,0x0010,0x0010,
  299.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0111,0x01ff},
  300.   /*U*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  301.           0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  302.   /*V*/  {000000,000000,000000,000000,0x0010,0x0010,0x0028,0x0028,0x0044,
  303.           0x0044,0x0082,0x0082,0x0101,0x0101,0x0101,0x0101,0x0101},
  304.   /*W*/  {000000,000000,000000,000000,0x0101,0x0183,0x0145,0x0145,0x0129,
  305.           0x0111,0x0111,0x0101,0x0101,0x0101,0x0101,0x0101,0x0101},
  306.   /*X*/  {000000,000000,000000,000000,0x0101,0x0101,0x0082,0x0082,0x0044,
  307.           0x0028,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  308.   /*Y*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  309.           0x0010,0x0010,0x0028,0x0044,0x0082,0x0082,0x0101,0x0101},
  310.   /*Z*/  {000000,000000,000000,000000,0x01ff,0x0001,0x0002,0x0002,0x0004,
  311.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0080,0x0100,0x01ff},
  312.   /*[*/  {000000,000000,000000,000000,0x007c,0x0004,0x0004,0x0004,0x0004,
  313.           0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x007c},
  314.   /*\*/  {000000,000000,000000,000000,000000,000000,0x0100,0x0080,0x0040,
  315.           0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,000000,000000},
  316.   /*]*/  {000000,000000,000000,000000,0x007c,0x0040,0x0040,0x0040,0x0040,
  317.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x007c},
  318.   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  319.           000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010},
  320.   /*_*/  {000000,000000,000000,000000,0x01ff,000000,000000,000000,000000,
  321.           000000,000000,000000,000000,000000,000000,000000,000000},
  322.   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  323.           000000,000000,0x0020,0x0010,0x0008,0x000c,0x001c,0x0008},
  324.   /*a*/  {000000,000000,000000,000000,0x03fc,0x0102,0x0101,0x0102,0x01fc,
  325.           0x0100,0x0100,0x0080,0x007c,000000,000000,000000,000000},
  326.   /*b*/  {000000,000000,000000,000000,0x007d,0x0083,0x0101,0x0101,0x0101,
  327.           0x0101,0x0101,0x0083,0x007d,0x0001,0x0001,0x0001,0x0001},
  328.   /*c*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0001,0x0001,
  329.           0x0001,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  330.   /*d*/  {000000,000000,000000,000000,0x017c,0x0182,0x0101,0x0101,0x0101,
  331.           0x0101,0x0101,0x0182,0x017c,0x0100,0x0100,0x0100,0x0100},
  332.   /*e*/  {000000,000000,000000,000000,0x007c,0x0002,0x0001,0x0001,0x01ff,
  333.           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  334.   /*f*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  335.           0x0010,0x007c,0x0010,0x0010,0x0010,0x0110,0x00a0,0x0040},
  336.   /*g*/  {0x007c,0x0082,0x0101,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  337.           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  338.   /*h*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  339.           0x0103,0x0103,0x0085,0x0079,0x0001,0x0001,0x0001,0x0001},
  340.   /*i*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  341.           0x0010,0x0010,0x0018,000000,000000,0x0018,0x0018,000000},
  342.   /*j*/  {0x003c,0x0042,0x0081,0x0080,0x0080,0x0080,0x0080,0x0080,0x0080,
  343.           0x0080,0x0080,0x00c0,000000,000000,0x00c0,0x00c0,000000},
  344.   /*k*/  {000000,000000,000000,000000,0x0082,0x0042,0x0022,0x0012,0x000a,
  345.           0x0016,0x0022,0x0042,0x0002,0x0002,0x0002,0x0002,0x0002},
  346.   /*l*/  {000000,000000,000000,000000,0x007c,0x0010,0x0010,0x0010,0x0010,
  347.           0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x0010,0x001c},
  348.   /*m*/  {000000,000000,000000,000000,0x0111,0x0111,0x0111,0x0111,0x0111,
  349.           0x0111,0x0111,0x00ab,0x0045,000000,000000,000000,000000},
  350.   /*n*/  {000000,000000,000000,000000,0x0101,0x0101,0x0101,0x0101,0x0101,
  351.           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  352.   /*o*/  {000000,000000,000000,000000,0x007c,0x0082,0x0101,0x0101,0x0101,
  353.           0x0101,0x0101,0x0082,0x007c,000000,000000,000000,000000},
  354.   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x007d,0x0003,0x0081,0x0101,0x0101,
  355.           0x0101,0x0101,0x0083,0x007d,000000,000000,000000,000000},
  356.   /*q*/  {0x0100,0x0100,0x0100,0x0100,0x017c,0x0182,0x0101,0x0101,0x0101,
  357.           0x0101,0x0101,0x0182,0x017c,000000,000000,000000,000000},
  358.   /*r*/  {000000,000000,000000,000000,0x0001,0x0001,0x0001,0x0001,0x0001,
  359.           0x0001,0x0103,0x0085,0x0079,000000,000000,000000,000000},
  360.   /*s*/  {000000,000000,000000,000000,0x007e,0x0081,0x0100,0x0080,0x007c,
  361.           0x0002,0x0001,0x0102,0x00fc,000000,000000,000000,000000},
  362.   /*t*/  {000000,000000,000000,000000,0x0040,0x00a0,0x0110,0x0010,0x0010,
  363.           0x0010,0x0010,0x0010,0x00fe,0x0010,0x0010,0x0010,0x0010},
  364.   /*u*/  {000000,000000,000000,000000,0x013c,0x0142,0x0181,0x0101,0x0101,
  365.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  366.   /*v*/  {000000,000000,000000,000000,0x0010,0x0028,0x0044,0x0082,0x0101,
  367.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  368.   /*w*/  {000000,000000,000000,000000,0x0044,0x00aa,0x0111,0x0111,0x0101,
  369.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  370.   /*x*/  {000000,000000,000000,000000,0x0101,0x0082,0x0044,0x0028,0x0010,
  371.           0x0028,0x0044,0x0082,0x0101,000000,000000,000000,000000},
  372.   /*y*/  {0x007c,0x0082,0x0101,0x0100,0x0100,0x01fc,0x0102,0x0101,0x0101,
  373.           0x0101,0x0101,0x0101,0x0101,000000,000000,000000,000000},
  374.   /*z*/  {000000,000000,000000,000000,0x01ff,0x0002,0x0004,0x0008,0x0010,
  375.           0x0020,0x0040,0x0080,0x01ff,000000,000000,000000,000000},
  376.   /*{*/  {000000,000000,000000,000000,0x00c0,0x0020,0x0010,0x0010,0x0010,
  377.           0x0008,0x0004,0x0008,0x0010,0x0010,0x0010,0x0020,0x00c0},
  378.   /*|*/  {000000,000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010,
  379.           000000,000000,000000,0x0010,0x0010,0x0010,0x0010,0x0010},
  380.   /*}*/  {000000,000000,000000,000000,0x0006,0x0008,0x0010,0x0010,0x0010,
  381.           0x0020,0x0040,0x0020,0x0010,0x0010,0x0010,0x0008,0x0006},
  382.   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  383.           000000,000000,000000,0x0040,0x00a0,0x0111,0x000a,0x0004},
  384.   /*DEL*/{000000,000000,000000,000000,0x0155,000000,0x0155,000000,0x0155,
  385.           000000,0x0155,000000,0x0155,000000,0x0155,000000,0x0155},
  386. };
  387.  
  388. /* 13x25 font, bottom row first, left pixel in lsb */
  389. char_row GPFAR fnt13x25[FNT_CHARS][FNT13X25_VBITS] = {
  390.   /* */  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  391.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  392.           000000,000000,000000,000000,000000,000000,000000},
  393.   /*!*/  {000000,000000,000000,000000,000000,0x00e0,0x00e0,0x00e0,000000,
  394.           000000,000000,0x0040,0x0040,0x0040,0x0040,0x0040,0x00e0,0x00e0,
  395.           0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x00e0,0x0040},
  396.   /*"*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  397.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  398.           0x0208,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  399.   /*#*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0208,0x0208,
  400.           0x0208,0x0208,0x0208,0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,
  401.           0x1fff,0x0208,0x0208,0x0208,0x0208,0x0208,0x0208},
  402.   /*$*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  403.           0x03f8,0x0444,0x0842,0x0840,0x0840,0x0440,0x03f8,0x0044,0x0042,
  404.           0x0042,0x0842,0x0444,0x03f8,0x0040,0x0040,0x0040},
  405.   /*%*/  {000000,000000,000000,000000,000000,000000,0x0c00,0x1200,0x1201,
  406.           0x0c01,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  407.           0x0200,0x0400,0x0800,0x1006,0x1009,0x0009,0x0006},
  408.   /*&*/  {000000,000000,000000,000000,000000,000000,0x1078,0x1084,0x0902,
  409.           0x0601,0x0601,0x0901,0x1081,0x0042,0x0024,0x0018,0x0018,0x0024,
  410.           0x0042,0x0042,0x0042,0x0042,0x0024,0x0018,000000},
  411.   /*'*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  412.           000000,000000,000000,000000,000000,0x0001,0x0002,0x0004,0x0008,
  413.           0x0010,0x0030,0x0078,0x0078,0x0078,0x0030,000000},
  414.   /*(*/  {000000,000000,000000,000000,000000,000000,0x0080,0x0040,0x0020,
  415.           0x0020,0x0010,0x0008,0x0008,0x0004,0x0004,0x0004,0x0004,0x0004,
  416.           0x0008,0x0008,0x0010,0x0020,0x0020,0x0040,0x0080},
  417.   /*)*/  {000000,000000,000000,000000,000000,000000,0x0020,0x0040,0x0080,
  418.           0x0080,0x0100,0x0200,0x0200,0x0400,0x0400,0x0400,0x0400,0x0400,
  419.           0x0200,0x0200,0x0100,0x0080,0x0080,0x0040,0x0020},
  420.   /***/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  421.           0x1041,0x0842,0x0444,0x0248,0x0150,0x00e0,0x1fff,0x00e0,0x0150,
  422.           0x0248,0x0444,0x0842,0x1041,0x0040,0x0040,0x0040},
  423.   /*+*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  424.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x1fff,0x0040,0x0040,
  425.           0x0040,0x0040,0x0040,0x0040,000000,000000,000000},
  426.   /*,*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  427.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  428.           000000,000000,000000,000000,000000,000000,000000},
  429.   /*-*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  430.           000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  431.           000000,000000,000000,000000,000000,000000,000000},
  432.   /*.*/  {000000,000000,000000,000000,000000,000000,000000,0x0038,0x007c,
  433.           0x007c,0x007c,0x0038,000000,000000,000000,000000,000000,000000,
  434.           000000,000000,000000,000000,000000,000000,000000},
  435.   /*-/-*/{000000,000000,000000,000000,000000,000000,000000,000000,0x0001,
  436.           0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  437.           0x0200,0x0400,0x0800,0x1000,0x1000,000000,000000},
  438.   /*0*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  439.           0x1001,0x1003,0x1005,0x1009,0x1011,0x1021,0x1041,0x1081,0x1101,
  440.           0x1201,0x1401,0x1801,0x1001,0x0802,0x0404,0x03f8},
  441.   /*1*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  442.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  443.           0x0040,0x0040,0x0040,0x0048,0x0070,0x0060,0x0040},
  444.   /*2*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  445.           0x0001,0x0001,0x0001,0x0001,0x0002,0x03fc,0x0400,0x0800,0x1000,
  446.           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  447.   /*3*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  448.           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03e0,0x0400,0x0800,
  449.           0x1000,0x1000,0x1000,0x1001,0x0802,0x0404,0x03f8},
  450.   /*4*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0200,0x0200,
  451.           0x0200,0x0200,0x0200,0x0200,0x1fff,0x0201,0x0201,0x0202,0x0204,
  452.           0x0208,0x0210,0x0220,0x0240,0x0280,0x0300,0x0200},
  453.   /*5*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  454.           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x0800,0x0400,0x03ff,
  455.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  456.   /*6*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  457.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff,0x0001,0x0001,
  458.           0x0001,0x0001,0x0002,0x0004,0x0808,0x0410,0x03e0},
  459.   /*7*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  460.           0x0002,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  461.           0x0200,0x0400,0x0800,0x0800,0x1000,0x1000,0x1fff},
  462.   /*8*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  463.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8,0x0404,0x0802,
  464.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  465.   /*9*/  {000000,000000,000000,000000,000000,000000,0x00f8,0x0104,0x0202,
  466.           0x0400,0x0800,0x1000,0x1000,0x1000,0x1000,0x1ff8,0x1004,0x1002,
  467.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  468.   /*:*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x0030,
  469.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  470.           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  471.   /*;*/  {000000,000000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0030,0x0078,
  472.           0x0078,0x0078,0x0030,000000,000000,000000,000000,000000,000000,
  473.           0x0030,0x0078,0x0078,0x0030,000000,000000,000000},
  474.   /*<*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0100,0x0080,
  475.           0x0040,0x0020,0x0010,0x0008,0x0004,0x0002,0x0001,0x0002,0x0004,
  476.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200},
  477.   /*=*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  478.           000000,000000,000000,0x1fff,000000,000000,000000,000000,000000,
  479.           0x1fff,000000,000000,000000,000000,000000,000000},
  480.   /*>*/  {000000,000000,000000,000000,000000,000000,0x0008,0x0010,0x0020,
  481.           0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,0x1000,0x0800,0x0400,
  482.           0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,0x0008},
  483.   /*?*/  {000000,000000,000000,000000,000000,0x0040,0x00e0,0x0040,000000,
  484.           000000,000000,0x0040,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  485.           0x1000,0x1000,0x1001,0x1001,0x0802,0x0404,0x03f8},
  486.   /*@*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0002,
  487.           0x0001,0x0001,0x0ee1,0x1111,0x1111,0x1111,0x1111,0x1111,0x12e1,
  488.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  489.   /*A*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  490.           0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,0x1001,0x1001,0x0802,
  491.           0x0802,0x0404,0x0208,0x0110,0x00a0,0x00a0,0x0040},
  492.   /*B*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  493.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03f8,0x0408,0x0808,
  494.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  495.   /*C*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  496.           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  497.           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  498.   /*D*/  {000000,000000,000000,000000,000000,000000,0x03ff,0x0408,0x0808,
  499.           0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,0x1008,
  500.           0x1008,0x1008,0x1008,0x1008,0x0808,0x0408,0x03ff},
  501.   /*E*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  502.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  503.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  504.   /*F*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  505.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x007f,0x0001,0x0001,
  506.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1fff},
  507.   /*G*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x1004,0x1002,
  508.   òjXו–—0x1001,0x1001,0x1001,0x1001,0x1001,0x1f01,0x0001,0x0001,
  509.           0x0001,0x0001,0x0001,0x0001,0x0002,0x1004,0x0ff8},
  510.   /*H*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  511.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1fff,0x1001,0x1001,
  512.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  513.   /*I*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  514.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  515.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8},
  516.   /*J*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  517.           0x1001,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
  518.           0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1e00},
  519.   /*K*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  520.           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x000f,0x0009,0x0011,
  521.           0x0021,0x0041,0x0081,0x0101,0x0201,0x0401,0x0801},
  522.   /*L*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x1001,0x1001,
  523.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,
  524.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  525.   /*M*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  526.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1041,0x1041,0x10a1,
  527.           0x10a1,0x1111,0x1209,0x1209,0x1405,0x1803,0x1001},
  528.   /*N*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  529.           0x1001,0x1801,0x1401,0x1201,0x1201,0x1101,0x1081,0x1041,0x1041,
  530.           0x1021,0x1011,0x1009,0x1009,0x1005,0x1003,0x1001},
  531.   /*O*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  532.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  533.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  534.   /*P*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  535.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03ff,0x0401,0x0801,
  536.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  537.   /*Q*/  {000000,000000,000000,000000,0x0c00,0x0200,0x03f8,0x0494,0x0862,
  538.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  539.           0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,0x03f8},
  540.   /*R*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0801,0x0401,
  541.           0x0201,0x0101,0x0081,0x0041,0x0021,0x0011,0x03ff,0x0401,0x0801,
  542.           0x1001,0x1001,0x1001,0x1001,0x0801,0x0401,0x03ff},
  543.   /*S*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  544.           0x1001,0x1000,0x1000,0x1000,0x0800,0x0400,0x03f8,0x0004,0x0002,
  545.           0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,0x03f8},
  546.   /*T*/  {000000,000000,000000,000000,000000,000000,0x00e0,0x0040,0x0040,
  547.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  548.           0x0040,0x0040,0x0040,0x0040,0x0040,0x1041,0x1fff},
  549.   /*U*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  550.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  551.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  552.   /*V*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x00a0,
  553.           0x00a0,0x0110,0x0110,0x0208,0x0208,0x0404,0x0404,0x0802,0x0802,
  554.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  555.   /*W*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1803,
  556.           0x1405,0x1405,0x1209,0x1209,0x1111,0x1111,0x10a1,0x1041,0x1001,
  557.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001},
  558.   /*X*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  559.           0x0802,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,
  560.           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001},
  561.   /*Y*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  562.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x00a0,0x0110,0x0208,
  563.           0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001},
  564.   /*Z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0001,0x0001,
  565.           0x0002,0x0004,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,
  566.           0x0200,0x0400,0x0400,0x0800,0x1000,0x1000,0x1fff},
  567.   /*[*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0008,0x0008,
  568.           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,
  569.           0x0008,0x0008,0x0008,0x0008,0x0008,0x0008,0x03f8},
  570.   /*\*/  {000000,000000,000000,000000,000000,000000,000000,000000,0x1000,
  571.           0x1000,0x0800,0x0400,0x0200,0x0100,0x0080,0x0040,0x0020,0x0010,
  572.           0x0008,0x0004,0x0002,0x0001,0x0001,000000,000000},
  573.   /*]*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0200,0x0200,
  574.           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,
  575.           0x0200,0x0200,0x0200,0x0200,0x0200,0x0200,0x03f8},
  576.   /*^*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  577.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  578.           0x1001,0x0802,0x0404,0x0208,0x0110,0x00a0,0x0040},
  579.   /*_*/  {000000,000000,000000,000000,000000,000000,0x1fff,000000,000000,
  580.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  581.           000000,000000,000000,000000,000000,000000,000000},
  582.   /*`*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  583.           000000,000000,000000,000000,000000,0x0400,0x0200,0x0100,0x0080,
  584.           0x0040,0x0060,0x00f0,0x00f0,0x00f0,0x0060,000000},
  585.   /*a*/  {000000,000000,000000,000000,000000,000000,0x17f8,0x0804,0x0802,
  586.           0x0802,0x0802,0x0804,0x0ff8,0x0800,0x0800,0x0800,0x0800,0x0404,
  587.           0x03f8,000000,000000,000000,000000,000000,000000},
  588.   /*b*/  {000000,000000,000000,000000,000000,000000,0x03f9,0x0405,0x0803,
  589.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  590.           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  591.   /*c*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  592.           0x1001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0802,0x0404,
  593.           0x03f8,000000,000000,000000,000000,000000,000000},
  594.   /*d*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  595.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  596.           0x13f8,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000},
  597.   /*e*/  {000000,000000,000000,000000,000000,000000,0x0ff8,0x0004,0x0002,
  598.           0x0001,0x0001,0x0001,0x1fff,0x1001,0x1001,0x1001,0x0802,0x0404,
  599.           0x03f8,000000,000000,000000,000000,000000,000000},
  600.   /*f*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  601.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x03f8,0x0040,0x0040,
  602.           0x0040,0x0040,0x0040,0x1040,0x0880,0x0500,0x0200},
  603.   /*g*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x13f8,0x1404,0x1802,
  604.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  605.           0x13f8,000000,000000,000000,000000,000000,000000},
  606.   /*h*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  607.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  608.           0x03f9,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001},
  609.   /*i*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  610.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070,
  611.           000000,000000,000000,0x00e0,0x00e0,0x00e0,000000},
  612.   /*j*/  {0x00f0,0x0108,0x0204,0x0402,0x0400,0x0400,0x0400,0x0400,0x0400,
  613.           0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0400,0x0700,
  614.           000000,000000,000000,0x0700,0x0700,0x0700,000000},
  615.   /*k*/  {000000,000000,000000,000000,000000,000000,0x0804,0x0404,0x0204,
  616.           0x0104,0x0084,0x0044,0x0024,0x0014,0x002c,0x0044,0x0084,0x0104,
  617.           0x0204,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004},
  618.   /*l*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0040,0x0040,
  619.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  620.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0070},
  621.   /*m*/  {000000,000000,000000,000000,000000,000000,0x1041,0x1041,0x1041,
  622.           0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x1041,0x08a3,0x0515,
  623.           0x0209,000000,000000,000000,000000,000000,000000},
  624.   /*n*/  {000000,000000,000000,000000,000000,000000,0x1001,0x1001,0x1001,
  625.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  626.           0x03f9,000000,000000,000000,000000,000000,000000},
  627.   /*o*/  {000000,000000,000000,000000,000000,000000,0x03f8,0x0404,0x0802,
  628.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0802,0x0404,
  629.           0x03f8,000000,000000,000000,000000,000000,000000},
  630.   /*p*/  {0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x03f9,0x0405,0x0803,
  631.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x0803,0x0405,
  632.           0x03f9,000000,000000,000000,000000,000000,000000},
  633.   /*q*/  {0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x13f8,0x1404,0x1802,
  634.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1802,0x1404,
  635.           0x13f8,000000,000000,000000,000000,000000,000000},
  636.   /*r*/  {000000,000000,000000,000000,000000,000000,0x0001,0x0001,0x0001,
  637.           0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x1001,0x0803,0x0405,
  638.           0x03f9,000000,000000,000000,000000,000000,000000},
  639.   /*s*/  {000000,000000,000000,000000,000000,000000,0x03fc,0x0402,0x0800,
  640.           0x0800,0x0800,0x0400,0x03f8,0x0004,0x0002,0x0002,0x0002,0x0804,
  641.           0x07f8,000000,000000,000000,000000,000000,000000},
  642.   /*t*/  {000000,000000,000000,000000,000000,000000,0x0200,0x0500,0x0880,
  643.           0x1040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,
  644.           0x07fc,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  645.   /*u*/  {000000,000000,000000,000000,000000,000000,0x13f8,0x1404,0x1802,
  646.           0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  647.           0x1001,000000,000000,000000,000000,000000,000000},
  648.   /*v*/  {000000,000000,000000,000000,000000,000000,0x0040,0x00a0,0x0110,
  649.           0x0208,0x0404,0x0802,0x0802,0x1001,0x1001,0x1001,0x1001,0x1001,
  650.           0x1001,000000,000000,000000,000000,000000,000000},
  651.   /*w*/  {000000,000000,000000,000000,000000,000000,0x0208,0x0514,0x08a2,
  652.           0x08a2,0x1041,0x1041,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  653.           0x1001,000000,000000,000000,000000,000000,000000},
  654.   /*x*/  {000000,000000,000000,000000,000000,000000,0x1001,0x0802,0x0404,
  655.           0x0208,0x0110,0x00a0,0x0040,0x00a0,0x0110,0x0208,0x0404,0x0802,
  656.           0x1001,000000,000000,000000,000000,000000,000000},
  657.   /*y*/  {0x03f8,0x0404,0x0802,0x1001,0x1000,0x1000,0x1000,0x1000,0x1ff8,
  658.           0x1004,0x1002,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,0x1001,
  659.           0x1001,000000,000000,000000,000000,000000,000000},
  660.   /*z*/  {000000,000000,000000,000000,000000,000000,0x1fff,0x0002,0x0004,
  661.           0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0400,0x0800,
  662.           0x1fff,000000,000000,000000,000000,000000,000000},
  663.   /*{*/  {000000,000000,000000,000000,000000,000000,0x0600,0x0100,0x0080,
  664.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x0020,0x0040,
  665.           0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0600},
  666.   /*|*/  {000000,000000,000000,000000,000000,000000,0x0040,0x0040,0x0040,
  667.           0x0040,0x0040,0x0040,0x0040,000000,000000,000000,000000,000000,
  668.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0040,0x0040},
  669.   /*}*/  {000000,000000,000000,000000,000000,000000,0x000c,0x0010,0x0020,
  670.           0x0040,0x0040,0x0040,0x0040,0x0040,0x0080,0x0100,0x0080,0x0040,
  671.           0x0040,0x0040,0x0040,0x0040,0x0020,0x0010,0x000c},
  672.   /*~*/  {000000,000000,000000,000000,000000,000000,000000,000000,000000,
  673.           000000,000000,000000,000000,000000,000000,000000,000000,000000,
  674.           0x0600,0x0900,0x1080,0x1041,0x0021,0x0012,0x000c},
  675.   /*DEL*/{000000,000000,000000,000000,000000,000000,0x1249,000000,000000,
  676.           0x1249,000000,000000,0x1249,000000,000000,0x1249,000000,000000,
  677.           0x1249,000000,000000,0x1249,000000,000000,0x1249},
  678. };
  679.  
  680. /* Moved here from gif.trm */
  681. struct rgb web_color_rgbs[] =
  682. {
  683.     { 0xff, 0xff, 0xff },        /* background: white         */
  684.     { 0x00, 0x00, 0x00 },        /*    borders: black         */
  685.     { 0xa0, 0xa0, 0xa0 },        /* x & y axes: grey          */
  686.     { 0xff, 0x00, 0x00 },        /*   color 01: red           */
  687.     { 0x00, 0xc0, 0x00 },        /*   color 02: dark green    */
  688.     { 0x00, 0x80, 0xff },        /*   color 03: dark blue     */
  689.     { 0xc0, 0x00, 0xff },        /*   color 04: dark magenta  */
  690.     { 0xc0, 0xff, 0x40 },        /*   color 05: yellow        */
  691.     { 0xc0, 0x40, 0x00 },        /*   color 06: orange        */
  692.     { 0x40, 0xff, 0x80 },        /*   color 07: sea green     */
  693.     { 0x20, 0x20, 0xc0 },        /*   color 08: royal blue    */
  694.     { 0x80, 0x00, 0xc0 },        /*   color 09: dark violet   */
  695.     /* please note: these colors are optimized for web216 compatibility */
  696.     { 0x00, 0x60, 0x80 },        /* DeepSkyBlue4 */
  697.     { 0x00, 0x80, 0x00 },        /* green4 */
  698.     { 0x00, 0x80, 0x40 },        /* SpringGreen4 */
  699.     { 0x00, 0x80, 0x80 },        /* dark cyan, turquoise4 */
  700.     { 0x00, 0xc0, 0x60 },        /* SpringGreen3 */
  701.     { 0x00, 0xc0, 0xc0 },        /* cyan3, turquoise3 */
  702.     { 0x00, 0xff, 0x00 },        /* green */
  703.     { 0x20, 0x80, 0x20 },        /* forest green */
  704.     { 0x30, 0x60, 0x80 },        /* SteelBlue4 */
  705.     { 0x40, 0x40, 0x40 },        /* grey25-31 */
  706.     { 0x40, 0x80, 0x00 },        /* chartreuse4 */
  707.     { 0x00, 0x00, 0x80 },        /* dark blue, navy blue */
  708.     { 0x80, 0x60, 0x00 },        /* DarkGoldenrod4 */
  709.     { 0x80, 0x60, 0x10 },        /* goldenrod4 */
  710.     { 0x80, 0x60, 0x60 },        /* pink4 */
  711.     { 0x80, 0x60, 0x80 },        /* plum4 */
  712.     { 0x00, 0x00, 0xc0 },        /* medium blue */
  713.     { 0x00, 0x00, 0xff },        /* blue */
  714.     { 0x00, 0x60, 0x00 },        /* dark green */
  715.     { 0x40, 0xc0, 0x80 },        /* SeaGreen3 */
  716.     { 0x60, 0xa0, 0xc0 },        /* SkyBlue3 */
  717.     { 0x60, 0xc0, 0x00 },        /* chartreuse3 */
  718.     { 0x60, 0xc0, 0xa0 },        /* medium aquamarine */
  719.     { 0x80, 0x00, 0x00 },        /* dark red */
  720.     { 0x80, 0x00, 0x80 },        /* dark magenta */
  721.     { 0x60, 0x20, 0x80 },        /* DarkOrchid4 */
  722.     { 0x60, 0x60, 0x60 },        /* dim grey */
  723.     { 0x00, 0xff, 0xff },        /* cyan1, turquoise1 */
  724.     { 0x20, 0x20, 0x20 },        /* grey13-18 */
  725.     { 0x20, 0x40, 0x40 },        /* dark slate grey */
  726.     { 0x20, 0x40, 0x80 },        /* RoyalBlue4 */
  727.     { 0x60, 0x80, 0x20 },        /* olive drab */
  728.     { 0x60, 0x80, 0x60 },        /* DarkSeaGreen4 */
  729.     { 0x60, 0x80, 0x80 },        /* LightBlue4, PaleTurquoise4 */
  730.     { 0x80, 0x80, 0x40 },        /* LightGoldenrod4, khaki4 */
  731.     { 0x80, 0x80, 0x80 },        /* grey51-56 */
  732.     { 0xa0, 0xa0, 0xa0 },        /* dark grey, grey63-68 */
  733.     { 0xa0, 0xd0, 0xe0 },        /* light blue */
  734.     { 0xc0, 0x20, 0x20 },        /* firebrick3 */
  735.     { 0xc0, 0x60, 0x00 },        /* DarkOrange3 */
  736.     { 0x80, 0xc0, 0xe0 },        /* sky blue */
  737.     { 0xc0, 0x60, 0xc0 },        /* orchid3 */
  738.     { 0xc0, 0x80, 0x00 },        /* orange3 */
  739.     { 0xc0, 0x80, 0x60 },        /* LightSalmon3 */
  740.     { 0xff, 0x40, 0x00 },        /* orange red */
  741.     { 0xff, 0x40, 0x40 },        /* brown1, tomato */
  742.     { 0x80, 0xc0, 0xff },        /* light sky blue */
  743.     { 0xff, 0x80, 0x60 },        /* salmon */
  744.     { 0xff, 0x80, 0x80 },        /* light coral */
  745.     { 0xc0, 0xa0, 0x00 },        /* gold3 */
  746.     { 0xc0, 0xc0, 0xc0 },        /* grey76-81, honeydew3, ivory3, snow3 */
  747.     { 0xc0, 0xff, 0xc0 },        /* DarkSeaGreen1 */
  748.     { 0xff, 0x00, 0x00 },        /* red */
  749.     { 0xff, 0x00, 0xff },        /* magenta */
  750.     { 0xff, 0x80, 0xa0 },        /* PaleVioletRed1 */
  751.     { 0xff, 0x80, 0xff },        /* orchid1 */
  752.     { 0xc0, 0xc0, 0xa0 },        /* LemonChiffon3 */
  753.     { 0xff, 0x60, 0x60 },        /* IndianRed1 */
  754.     { 0xff, 0x80, 0x00 },        /* dark orange */
  755.     { 0xff, 0xa0, 0x00 },        /* orange */
  756.     { 0x80, 0xe0, 0xe0 },        /* CadetBlue2, DarkSlateGray2 */
  757.     { 0xa0, 0xe0, 0xe0 },        /* pale turquoise */
  758.     { 0xa0, 0xff, 0x20 },        /* green yellow */
  759.     { 0xc0, 0x00, 0x00 },        /* red3 */
  760.     { 0xc0, 0x00, 0xc0 },        /* magenta3 */
  761.     { 0xa0, 0x20, 0x20 },        /* brown */
  762.     { 0xa0, 0x20, 0xff },        /* purple */
  763.     { 0x80, 0x20, 0x00 },        /* OrangeRed4 */
  764.     { 0x80, 0x20, 0x20 },        /* brown4 */
  765.     { 0x80, 0x40, 0x00 },        /* DarkOrange4 */
  766.     { 0x80, 0x40, 0x20 },        /* sienna4 */
  767.     { 0x80, 0x40, 0x80 },        /* orchid4 */
  768.     { 0x80, 0x60, 0xc0 },        /* MediumPurple3 */
  769.     { 0x80, 0x60, 0xff },        /* SlateBlue1 */
  770.     { 0x80, 0x80, 0x00 },        /* yellow4 */
  771.     { 0xa0, 0x80, 0xff },        /* MediumPurple1 */
  772.     { 0xc0, 0x60, 0x80 },        /* PaleVioletRed3 */
  773.     { 0xc0, 0xc0, 0x00 },        /* yellow3 */
  774.     { 0xff, 0x80, 0x40 },        /* sienna1 */
  775.     { 0xff, 0xa0, 0x40 },        /* tan1 */
  776.     { 0xff, 0xa0, 0x60 },        /* sandy brown */
  777.     { 0xff, 0xa0, 0x70 },        /* light salmon */
  778.     { 0xff, 0xc0, 0x20 },        /* goldenrod1 */
  779.     { 0xff, 0xc0, 0xc0 },        /* RosyBrown1, pink */
  780.     { 0xff, 0xff, 0x00 },        /* yellow */
  781.     { 0xff, 0xff, 0x80 },        /* khaki1 */
  782.     { 0xff, 0xff, 0xc0 }        /* lemon chiffon */
  783. };
  784.  
  785. /*
  786.    ** The plotting area is defined as a huge bitmap.
  787.    ** The bitmap is stored in a dynamically allocated pixel array b_p
  788.    **
  789.    ** The bitmap is allocated (and initialized to zero) with
  790.    ** b_makebitmap(xsize, ysize, planes)
  791.    ** and freed with b_freebitmap()
  792.    ** xsize and ysize will be rounded up to a multiple of 8.
  793.    **
  794.    ** Valid (int) coordinates range from zero to (xsize-1,ysize-1)
  795.    **
  796.    ** Plotting is done via b_move(x, y) and b_vector(x, y) functions,
  797.    ** where the point (x,y) is the target to go from the current point
  798.    ** To set the color use b_setvalue(value) where value is the value 
  799.    ** (0 or 1 or a color number) to be stored in every pixel.
  800.    ** To get dotted line styles, use b_setlinetype(linetype).
  801.    **
  802.    ** Internally all plotting goes through b_setpixel(x, y, value).
  803.  */
  804.  
  805.  
  806. /*
  807.  * set pixel (x, y, value) to value value (this can be 1/0 or a color number).
  808.  */
  809. void b_setpixel(x, y, value)
  810. unsigned int x, y, value;
  811. {
  812.     register unsigned int row;
  813.     register unsigned char mask;
  814.     unsigned int i;
  815.  
  816.     if (b_rastermode) {
  817.     /* interchange so that new (x,y) is old (y,b_ysize-1-x) */
  818.     row = x;        /* temp storage */
  819.     x = y;
  820.     y = b_ysize - 1 - row;
  821.     }
  822.     if (IN(x, b_xsize) && IN(y, b_ysize)) {
  823.     row = y / 8;
  824.     mask = 1 << (y % 8);
  825.  
  826.     for (i = 0; i < b_planes; i++) {
  827.         if (value & 1)
  828.         *((*b_p)[row] + x) |= mask;
  829.         else
  830.         *((*b_p)[row] + x) &= ~mask;
  831.         row += b_psize;
  832.         value >>= 1;
  833.     }
  834.     }
  835. #ifdef BITMAPDEBUG
  836.     else {
  837.     if (b_rastermode)
  838.         fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
  839.             b_ysize - 1 - y, x, value);
  840.     else
  841.         fprintf(stderr, "Warning: setpixel(%d, %d, %d) out of bounds\n",
  842.             x, y, value);
  843.     }
  844. #endif
  845. }
  846.  
  847.  
  848. /* Currently unused */
  849. #if 1 /* HBB 991008: used by PNG, now */
  850. /*
  851.  * get pixel (x,y) value
  852.  */
  853. unsigned int
  854. b_getpixel(x, y)
  855. unsigned int x, y;
  856. {
  857.   register unsigned int row;
  858.   register unsigned char mask;
  859.   register unsigned char value;
  860.   int i;
  861.  
  862.   if (b_rastermode) {
  863.     row = x;
  864.     x = y;
  865.     y = b_ysize-1-row;
  866.   }
  867.   if (IN(x, b_xsize) && IN(y, b_ysize))
  868.   {
  869.     row = y/8 + (b_planes-1)*b_psize;
  870.     mask = 1<<(y%8);
  871.  
  872.     for (i=0; i<b_planes; i++) {
  873.         if ( *((*b_p)[row]+x) & mask )
  874.             value |= 1;
  875.         row -= b_psize;
  876.         value <<= 1;
  877.     }
  878.     return(value);
  879.   }
  880.   else
  881.   {
  882. #ifdef BITMAPDEBUG
  883.     if (b_rastermode)
  884.       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n",
  885.         b_ysize-1-y, x);
  886.     else
  887.       fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", x, y);
  888. #endif
  889.     return(0);
  890.   }
  891. }
  892. #endif /* 0 */
  893.  
  894.  
  895. /*
  896.  * allocate the bitmap
  897.  */
  898. void b_makebitmap(x, y, planes)
  899. unsigned int x, y, planes;
  900. {
  901.     register unsigned j;
  902.     unsigned rows;
  903.  
  904.     x = 8 * (unsigned int) (x / 8.0 + 0.9);    /* round up to multiple of 8 */
  905.     y = 8 * (unsigned int) (y / 8.0 + 0.9);    /* round up to multiple of 8 */
  906.     b_psize = y / 8;        /* size of each plane */
  907.     rows = b_psize * planes;    /* total number of rows of 8 pixels high */
  908.     b_xsize = x;
  909.     b_ysize = y;
  910.     b_currx = b_curry = 0;
  911.     b_planes = planes;
  912.     b_value = 1;
  913.     b_angle = 0;
  914.     b_rastermode = 0;
  915.     /* allocate row pointers */
  916.     b_p = (bitmap *) gp_alloc((unsigned long) rows * sizeof(pixels *), "bitmap row buffer");
  917.     memset(b_p, 0, rows * sizeof(pixels *));
  918.     for (j = 0; j < rows; j++) {
  919.     /* allocate bitmap buffers */
  920.     (*b_p)[j] = (pixels *) gp_alloc((unsigned long) x * sizeof(pixels), (char *) NULL);
  921.     if ((*b_p)[j] == (pixels *) NULL) {
  922.         b_freebitmap();    /* free what we have already allocated */
  923.         int_error("out of memory for bitmap buffer", NO_CARET);
  924.     }
  925.     memset((*b_p)[j], 0, x * sizeof(pixels));
  926.     }
  927. }
  928.  
  929.  
  930. /*
  931.  * free the allocated bitmap
  932.  */
  933. void b_freebitmap()
  934. {
  935.     unsigned int j, rows;
  936.  
  937.     rows = b_psize * b_planes;    /* total number of rows of 8 pixels high */
  938.     for (j = 0; j < rows; j++) {
  939.     (void) free((char *) (*b_p)[j]);
  940.     }
  941.     (void) free((char *) b_p);
  942.     b_p = (bitmap *) (NULL);
  943. }
  944.  
  945.  
  946. /*
  947.  * set pixel at (x,y) with color b_value and dotted mask b_linemask.
  948.  */
  949. void b_setmaskpixel(x, y, value)
  950. unsigned int x, y, value;
  951. {
  952.     /* dotted line generator */
  953.     if ((b_linemask >> b_maskcount) & (unsigned int) (1)) {
  954.     b_setpixel(x, y, value);
  955.     }
  956.     b_maskcount = (b_maskcount + 1) % 16;
  957.     b_lastx = x;        /* last pixel set with mask */
  958.     b_lasty = y;
  959. }
  960.  
  961.  
  962. /*
  963.  * draw a line from (x1,y1) to (x2,y2)
  964.  * with color b_value and dotted mask b_linemask.
  965.  */
  966. void b_line(x1, y1, x2, y2)
  967. unsigned int x1, y1, x2, y2;
  968. {
  969.     int runcount;
  970.     int dx, dy;
  971.     int xinc, yinc;
  972.     unsigned int xplot, yplot;
  973.  
  974.     runcount = 0;
  975.     dx = abs((int) (x1) - (int) (x2));
  976.     if (x2 > x1)
  977.     xinc = 1;
  978.     else if (x2 == x1)
  979.     xinc = 0;
  980.     else
  981.     xinc = -1;
  982.     dy = abs((int) (y1) - (int) (y2));
  983.     if (y2 > y1)
  984.     yinc = 1;
  985.     else if (y2 == y1)
  986.     yinc = 0;
  987.     else
  988.     yinc = -1;
  989.     xplot = x1;
  990.     yplot = y1;
  991.     if (dx > dy) {
  992.     /* iterate x */
  993.     if ((b_linemask == 0xffff) ||
  994.         ((xplot != b_lastx) && (yplot != b_lasty)))
  995.         b_setmaskpixel(xplot, yplot, b_value);
  996.     while (xplot != x2) {
  997.         xplot += xinc;
  998.         runcount += dy;
  999.         if (runcount >= (dx - runcount)) {
  1000.         yplot += yinc;
  1001.         runcount -= dx;
  1002.         }
  1003.         b_setmaskpixel(xplot, yplot, b_value);
  1004.     }
  1005.     } else {
  1006.     /* iterate y */
  1007.     if ((b_linemask == 0xffff) ||
  1008.         ((xplot != b_lastx) && (yplot != b_lasty)))
  1009.         b_setmaskpixel(xplot, yplot, b_value);
  1010.     while (yplot != y2) {
  1011.         yplot += yinc;
  1012.         runcount += dx;
  1013.         if (runcount >= (dy - runcount)) {
  1014.         xplot += xinc;
  1015.         runcount -= dy;
  1016.         }
  1017.         b_setmaskpixel(xplot, yplot, b_value);
  1018.     }
  1019.     }
  1020. }
  1021.  
  1022.  
  1023. /*
  1024.  * set character size
  1025.  */
  1026. void b_charsize(size)
  1027. unsigned int size;
  1028. {
  1029.     int j;
  1030.     switch (size) {
  1031.     case FNT5X9:
  1032.     b_hchar = FNT5X9_HCHAR;
  1033.     b_hbits = FNT5X9_HBITS;
  1034.     b_vchar = FNT5X9_VCHAR;
  1035.     b_vbits = FNT5X9_VBITS;
  1036.     for (j = 0; j < FNT_CHARS; j++)
  1037.         b_font[j] = &fnt5x9[j][0];
  1038.     break;
  1039.     case FNT9X17:
  1040.     b_hchar = FNT9X17_HCHAR;
  1041.     b_hbits = FNT9X17_HBITS;
  1042.     b_vchar = FNT9X17_VCHAR;
  1043.     b_vbits = FNT9X17_VBITS;
  1044.     for (j = 0; j < FNT_CHARS; j++)
  1045.         b_font[j] = &fnt9x17[j][0];
  1046.     break;
  1047.     case FNT13X25:
  1048.     b_hchar = FNT13X25_HCHAR;
  1049.     b_hbits = FNT13X25_HBITS;
  1050.     b_vchar = FNT13X25_VCHAR;
  1051.     b_vbits = FNT13X25_VBITS;
  1052.     for (j = 0; j < FNT_CHARS; j++)
  1053.         b_font[j] = &fnt13x25[j][0];
  1054.     break;
  1055.     default:
  1056.     int_error("Unknown character size", NO_CARET);
  1057.     }
  1058. }
  1059.  
  1060.  
  1061. /*
  1062.  * put characater c at (x,y) rotated by angle with color b_value.
  1063.  */
  1064. static void b_putc(x, y, c, c_angle)
  1065. unsigned int x, y;
  1066. int c;
  1067. unsigned int c_angle;
  1068. {
  1069.     unsigned int i, j, k;
  1070.     char_row fc;
  1071.  
  1072.     j = c - ' ';
  1073.  
  1074.     if (j >= FNT_CHARS)
  1075.     return;            /* unknown (top-bit-set ?) character */
  1076.  
  1077.     for (i = 0; i < b_vbits; i++) {
  1078.     fc = *(b_font[j] + i);
  1079.     if (c == '_') {        /* treat underline specially */
  1080.         if (fc) {        /* this this the underline row ? */
  1081.         /* draw the under line for the full h_char width */
  1082.         for (k = (b_hbits - b_hchar) / 2;
  1083.              k < (b_hbits + b_hchar) / 2; k++) {
  1084.             switch (c_angle) {
  1085.             case 0:
  1086.             b_setpixel(x + k + 1, y + i, b_value);
  1087.             break;
  1088.             case 1:
  1089.             b_setpixel(x - i, y + k + 1, b_value);
  1090.             break;
  1091.             }
  1092.         }
  1093.         }
  1094.     } else {
  1095.         /* draw character */
  1096.         for (k = 0; k < b_hbits; k++) {
  1097.         if ((fc >> k) & 1) {
  1098.             switch (c_angle) {
  1099.             case 0:
  1100.             b_setpixel(x + k + 1, y + i, b_value);
  1101.             break;
  1102.             case 1:
  1103.             b_setpixel(x - i, y + k + 1, b_value);
  1104.             break;
  1105.             }
  1106.         }
  1107.         }
  1108.     }
  1109.     }
  1110. }
  1111.  
  1112.  
  1113. /*
  1114.    ** set b_linemask to b_pattern[linetype]
  1115.  */
  1116. void b_setlinetype(linetype)
  1117. int linetype;
  1118. {
  1119.     if (linetype >= 7)
  1120.     linetype %= 7;
  1121.     b_linemask = b_pattern[linetype + 2];
  1122.     b_maskcount = 0;
  1123. }
  1124.  
  1125.  
  1126. /*
  1127.  * set b_value to value
  1128.  */
  1129. void b_setvalue(value)
  1130. unsigned int value;
  1131. {
  1132.     b_value = value;
  1133. }
  1134.  
  1135.  
  1136. /*
  1137.  * move to (x,y)
  1138.  */
  1139. void b_move(x, y)
  1140. unsigned int x, y;
  1141. {
  1142.     b_currx = x;
  1143.     b_curry = y;
  1144. }
  1145.  
  1146.  
  1147. /*
  1148.  * draw to (x,y) with color b_value
  1149.  */
  1150. void b_vector(x, y)
  1151. unsigned int x, y;
  1152. {
  1153.     b_line(b_currx, b_curry, x, y);
  1154.     b_currx = x;
  1155.     b_curry = y;
  1156. }
  1157.  
  1158.  
  1159. /*
  1160.  * put text str at (x,y) with color b_value and rotation b_angle
  1161.  */
  1162. void b_put_text(x, y, str)
  1163. unsigned int x, y;
  1164. char *str;
  1165. {
  1166.     if (b_angle == 1)
  1167.     x += b_vchar / 2;
  1168.     else
  1169.     y -= b_vchar / 2;
  1170.     switch (b_angle) {
  1171.     case 0:
  1172.     for (; *str; ++str, x += b_hchar)
  1173.         b_putc(x, y, *str, b_angle);
  1174.     break;
  1175.     case 1:
  1176.     for (; *str; ++str, y += b_hchar)
  1177.         b_putc(x, y, *str, b_angle);
  1178.     break;
  1179.     }
  1180. }
  1181.  
  1182.  
  1183. int b_text_angle(ang)
  1184. int ang;
  1185. {
  1186.     b_angle = (unsigned int) ang;
  1187.     return TRUE;
  1188. }
  1189.